﻿<%@ WebHandler Language="C#" Class="lists" %>
using Models;
using System;
using System.Web;
using Newtonsoft.Json;
using System.Linq;
using Newtonsoft.Json.Linq;
using System.Collections;


public class lists : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";

        string query = HttpContext.Current.Request.Params["page"];
        string id = "1";

        if (string.IsNullOrEmpty(id))
        {
            HttpContext.Current.Response.Write("parameter error");
            return;
        }

        var code = 1;
        var msg = "获取成功";
        var time = DateTime.Now;


        using (Entities bll = new Entities())
        {
            int _id = int.Parse(id);

            var myclass = bll.P_Task.Where(x=>x.PointID==1).ToList();//全部.ToList();
            ArrayList listclass = new ArrayList();
           ArrayList listTaskDetail = new ArrayList();
            foreach (var mcx in myclass)
            {
           

            var ptdetail = bll.P_T_Detail.OrderByDescending(xx=>xx.id).ToList();//全部.ToList();

           
            foreach (var myda in ptdetail)
            {
                var myimgs = methods.GetImgs(myda.content_images);
                listTaskDetail.Add(new
                {
                    id=myda.id,
                    content_images=myimgs,
                    myda.content_text,
                    creattime=myda.addtime,
                    myda.State,
                    user=methods.getUserNickname(myda.UserId)

                });

            };



            }

            var shortName = "广科";
            var name ="ceshi ";
            var   image="/img/ico/jd.png";
            var latitude=22.972816;
            var longitude = 113.756003;

            var description = "";

            var introduce = new { shortName, name, latitude, longitude,image, description };


            context.Response.Write(JsonConvert.SerializeObject(new { code, msg, time, task=listTaskDetail,introduce  }));

        }

        HttpContext.Current.Response.End();
        //context.Response.Write("Hello World");


    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }




}